<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/global.css" media="all">
  <!--select2 js start-->
  <link rel="stylesheet" href="/static/select2/select2.css" media="all">
  <!--select2 js end-->  
  <style>
	  .set-select2 .select2-container .select2-choice{ height: 36px; line-height: 36px;}
	  .set-select2 .select2-container .select2-choice .select2-arrow b{ background: url(/static/select2/select2.png) no-repeat 0 4px;}
	  .select2-results .select2-highlighted{ background: #009688;}
  </style>
</head>
<body>

	<div class="layui-fluid">
	<div class="layui-card">
		
	<div class="layui-form-header">
		<div class="header-left" style="width:70%">
			<div class="layui-inline set-select2">
			  <select name="catid" class="select2" lay-ignore style="min-width:220px;" onchange="goLink(this)">{$catOption|raw}</select>
			  <a class="layui-btn layui-btn-primary" href="{:url('index',['catid'=>$cat['catid']])}"><i class="layui-icon layui-icon-ok-circle"></i> 已审核({$DataCount.index})</a>
			  <a class="layui-btn {$state=='readyCheck'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'readyCheck'])}"><i class="layui-icon layui-icon-fonts-clear"></i> 待审核({$DataCount.readyCheck})</a>
			  <a class="layui-btn {$state=='notCheck'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'notCheck'])}"><i class="layui-icon layui-icon-close"></i> 已退回({$DataCount.notCheck})</a>
			  <a class="layui-btn {$state=='draft'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'draft'])}"><i class="layui-icon layui-icon-edit"></i> 草稿({$DataCount.draft})</a>
				<a class="layui-btn {$state=='to_publish'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'to_publish'])}"><i class="layui-icon layui-icon-edit"></i> 定时发布({$DataCount.to_publish})</a>
			  <a class="layui-btn {$state=='recycle'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'recycle'])}"><i class="layui-icon layui-icon-delete"></i> 回收站({$DataCount.recycle})</a>
			</div>  
		</div>
		
		<div class="header-right" style="width:30%;">
			<div class="layui-inline">
				{if $Request.param.openSearch}
				<a href="{:url('',['catid'=>$cat['catid'],'openSearch'=>0])}" class="layui-btn layui-btn-primary layuiadmin-btn-list"><i class="layui-icon layui-icon-up"></i> 关闭搜索</a>	
				{else /}
				<a href="{:url('',['catid'=>$cat['catid'],'openSearch'=>1])}" class="layui-btn layui-btn-primary layuiadmin-btn-list"><i class="layui-icon layui-icon-down"></i> 展开搜索</a>				
				{/if}				
			  {if !$state || $state=="readyCheck" || $state=="draft"}
			  <a class="layui-btn layui-btn-primary layuiadmin-btn-list iframe" href="{:url('InfoImport/index',['catid'=>$cat['catid'],'state'=>$state])}" data-width="100%" data-height="100%"><i class="layui-icon layui-icon-app"></i> 导入</a>
			  {/if}
			  <a class="layui-btn" href="{:url('add',['catid'=>$cat['catid']])}"><i class="layui-icon layui-icon-addition"></i> 增加信息</a>
			</div>  
		</div>
		<div class="clear"></div>
		{if $Request.param.openSearch}
		<form action="{:url()}" method="get">
		<input type="hidden" name="catid" value="{$cat.catid}" />
		<input type="hidden" name="openSearch" value="1" />
        <div  class="layui-form layui-form-item info-search">
          <div class="layui-inline search-field">
            <label class="layui-form-label">
              <select lay-ignore name="searchField">
				  {foreach $SearchFieldInc as $v}
					<option value="{$v.field}" {if $Request.param.searchField==$v.field}selected{/if}>{$v.name}</option>
				  {/foreach}

			  </select>
			</label>
            <label class="layui-form-label" style="width: 80px;">
              <select lay-ignore name="searchFilter">
					<option value="like" {if $Request.param.searchFilter=='like'}selected{/if}>包含</option>
					<option value="notlike" {if $Request.param.searchFilter=='notlike'}selected{/if}>不包含</option>
					<option value="all" {if $Request.param.searchFilter=='all'}selected{/if}>完全匹配</option>
					<option value="eq" {if $Request.param.searchFilter=='eq'}selected{/if}>等于</option>
					<option value="neq" {if $Request.param.searchFilter=='neq'}selected{/if}>不等于</option>
					<option value="gt" {if $Request.param.searchFilter=='gt'}selected{/if}>大于</option>
					<option value="egt" {if $Request.param.searchFilter=='egt'}selected{/if}>大于等于</option>
					<option value="lt" {if $Request.param.searchFilter=='lt'}selected{/if}>小于</option>
					<option value="elt" {if $Request.param.searchFilter=='elt'}selected{/if}>小于待于</option>
			  </select>
			</label>			
            <div class="layui-input-inline">
              <input type="text" name="keywords" value="{$Request.param.keywords}" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>		

          <div class="layui-inline" style="float: right; width: auto; margin-right: 0px;">
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> 开始搜索
            </button>
            <a href="{:url('',['catid'=>$cat['catid'],'openSearch'=>0])}" class="layui-btn layui-btn-primary layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
              <i class="layui-icon layui-icon-close layuiadmin-button-btn"></i> 关闭搜索功能
            </a>			
          </div>
        </div>	
	</form>
				
	{/if}
	
	
	</div>				
		


	<div class="layui-card-body">
	<form class="layui-form" action="{:url('updateSort')}" method="post" onsubmit="return save_form(this)" lay-filter="component-form-element">
		<input type="hidden" name="catid" value="{$cat.catid}">
		<input type="hidden" name="remark" value="">
	<table class="layui-table">
	  <colgroup>
		<col width="150">
		<col width="150">
		<col width="200">
		<col>
	  </colgroup>
	  <thead>
		<tr>
			<th width="3%"><input type="checkbox" value="0" class="checkall" lay-ignore></input</th>
			<th style="width:8%">cache_id</th>
			<th style="width:8%">id</th>
			<th style="width:10%">分类</th>			
			<th style="width:20%;text-align: left;">标题</th>
			<th style="width:10%">用户</th>
			{if $state=="notCheck"}
				<th style="width:10%">审核不通过原因</th>
			{/if}
			{if $state=="to_publish"}
				<th style="width:10%">定时发布时间</th>
			{else/}
			<th style="width:10%">时间</th>
			{/if}

			<th style="width:20%">操作</th>
		</tr> 
	  </thead>
	  <tbody>
	  {foreach $data as $key=>$v}
		<tr>
			<td style="text-align: center;"><input type='checkbox' class="chekboxs" name="cache_ids[]" lay-ignore value="{$v.cache_id}"></td>			
			<td style="text-align: center;">{$v.cache_id}</td>
			<td style="text-align: center;">{$v.id}</td>
			<td style="text-align: center;">{$v.cat.name}</td>			
			<td class="tab-title">
				<a href="{:url('view2',array('cache_id'=>$v['cache_id'],'catid'=>$v['catid']))}">{$v.title}</a>                            
				{if $v["is_top"]}
					<span class="layui-badge">顶</span>
				{/if}
				{if $v["is_good"]}
					<span class="layui-badge layui-bg-orange">推</span>
				{/if}	
				{if $v["thumb"]}
					<span class="layui-badge layui-bg-blue">图</span>
				{/if}								
			</td>
			<td class="center">{$v.username}</td>
			{if $state=="notCheck"}
				<td class="center" style="color:red;">{$v.remark}<//td>
			{/if}
			{if $state=="to_publish"}
			<td class="center">{:date("Y-m-d H:i",$v['publish_time'])}</td>
			{else/}
			<td class="center">{:date("Y-m-d H:i",$v['newstime'])}</td>
			{/if}

		  <td class="center">
			<a href="{:url('view',array('cache_id'=>$v['cache_id'],'catid'=>$v['catid']))}" class="layui-btn layui-btn-sm iframe" title="预览"  data-width="80%" data-height="90%"><i class="layui-icon">&#xe615;</i></a>
			<a href="{:url('update',array('catid'=>$v['catid'],'cache_id'=>$v['cache_id']))}" class="layui-btn layui-btn-sm" title="修改页面"><i class="layui-icon">&#xe642;</i></a>
			<a href="{:url('delete',array('catid'=>$v['catid'],'cache_ids'=>$v['cache_id']))}" class="layui-btn layui-btn-sm ajax_del"><i class="layui-icon">&#xe640;</i></a>
		  </td>
		</tr>
	   {/foreach}
	  </tbody>
	</table>
	  <div class="layui-inline">
			<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" onclick="this_delete()">删除</button>
			{if $state=="readyCheck"}
			<ul class="layui-nav nav-button" lay-filter="component-nav" style="margin-left: 10px;">
			  <li class="layui-nav-item layui-this">
				<a href="javascript:;">审核</a>
				<dl class="layui-nav-child">
				  <dd><a onclick="check_pass()">审核通过</a></dd>
				  <dd><a onclick="un_check_pass()">审核不通过</a></dd>
				</dl>
			  </li>
			</ul>	
			{/if}	
			{if $state=="recycle"}
				<button type="button" class="layui-btn layui-btn-sm" onclick="$('.layui-form').attr('action','{:url("checked")}');$('.layui-form').submit();">恢复</button>
			{/if}                           
			{if $state=="notCheck" || $state=="draft"}
				<button type="button" class="layui-btn layui-btn-sm" onclick="$('.layui-form').attr('action','{:url("submitChecked")}');$('.layui-form').submit();">提交审核</button>
			{/if}
			
	  </div>  
		<div class="listpage">{$pagelist|raw}</div>
	</form>				  
	</div>
      
	</div>
</div>

  <script src="/static/admin/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>    
  <script src="/static/js/globals.js"></script>  
  
  <!--select2 js start-->
  <script src="/static/select2/select2.js"></script>
  
  <script>
  $('.select2').select2();
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
  });
  //删除
	function this_delete(){
		layer.confirm("此操作会彻底删除，您确定要删除吗？",function(){
			$('.layui-form').attr('action','{:url("delete")}');
			$('.layui-form').submit();
		},function(){layer.closeAll();return false;});
	}
	//审核通过
	function check_pass(){
		$('.layui-form').attr('action','{:url("checked")}');
		$('.layui-form').submit();
	}
	//审核不通过
	function un_check_pass(){
		layer.prompt({title: '请填写不通过的原因', formType: 2}, function(remark, index){
			layer.close(index);
			$("input[name='remark']").val(remark);
			$('.layui-form').attr('action','{:url("unChecked")}');
			$('.layui-form').submit();
		});
	}
  </script>

</body>
</html>
